package com.bilibili.juc.volatiles;
/*

 @auther heg
 * @create 2022-01-19 11:42

 */

public class Singleton {

    private volatile Singleton singleton;
    private Singleton() {}

    public Singleton getSingleton() {
        if (singleton == null) {
            synchronized (Singleton.class) {
                if (singleton == null) {
                    singleton = new Singleton();
                }
            }
        }
        return singleton;

    }
}